#include<bits/stdc++.h>
using namespace std;

int gcd(int m, int n)
{
	if(!n)
		return m;
	return gcd(n, m%n);
}

int main()
{
	int x, y;
	while(cin>>x>>y)
		cout<<gcd(x, y)<<endl;
	return 0;
}

